<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>测试页面1</title>
</head>

<body>
    <div>
        <h1>测试页面.....</h1>
        <button id="btn1">按钮</button>
        <button id="btn2">按钮</button>
        <button id="btnPhoto">拍照</button>
        <button id="btnSelect">选择相册</button>
        <img class="avatar" src="" alt="">
        <!-- 引入调试控制台 -->
        <script src="js/eruda.js"></script>
        <script>eruda.init();</script>
        <script>
            document.querySelector('#btn1').addEventListener('click', () => {
                // window.YB.showMessage("气死我了！！！")
                const user = YB.getUser() // 获取用户信息
                YB.showMessage(JSON.stringify(user)) // 弹出消息
            })
            // document.querySelector('#btn2').addEventListener('click', () => {
            //     window.ABC.showMessage("哈哈哈哈！！！")
            // })
            function changeH1(name) {
                document.querySelector("h1").innerText = name
            }
            document.querySelector("#btnPhoto").addEventListener("click", async () => {
                const url = await YB.takePicture()
                document.querySelector(".avatar").src = url
            })
            document.querySelector("#btnSelect").addEventListener("click", async () => {
            alert('aa')
                const url = await YB.selectPicture()
                document.querySelector(".avatar").src = url
            })
        </script>
    </div>
</body>

</html>